package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class TestOutputStream2 {

    public static void main(String[] args) throws IOException {
        //1.创建输出流
        OutputStream out=new FileOutputStream("d:\\a.txt");//默认会先删除文件内容在写
        //2.写数据
        String str="你好，五一放假，我来了~~~~666";
        out.write(str.getBytes());//getBytes()，把字符串转换成byte[]
        System.out.println("ok~~~");
    }
}
